package framework.common;

public class SensorResponse extends SensorMessage {
	public static final int OK = 1;
	public static final int ERR = -1;

	private int result;

	public SensorResponse(int result, String attr, Object value) {
		super(attr, value);
		this.result = result;
	}

	public SensorResponse() {
		super();
	}

	public int getResult() {
		return result;
	}

	public void setResult(int result) {
		this.result = result;
	}

	@Override
	public String toString() {
		switch (result) {
		case OK:
			return "{ok:" + super.toString() + "}";
		case ERR:
			return "{err:" + super.toString() + "}";
		default:
			return "{undef:" + super.toString() + "}";
		}
	}

	public boolean isError() {
		if (result == ERR)
			return true;
		return false;
	}

}
